﻿using System.Text;

namespace Dogshow.Win.Helpers
{
    public class QueryStringHelpers
    {
        public static bool AppendQueryString(StringBuilder sb, bool addedQuery)
        {
            if (!addedQuery)
            {
                sb.Append("?");
                addedQuery = true;
            }

            return addedQuery;
        }

        public static void RemoveTrailingAmpersand(StringBuilder sb)
        {
            if (sb.Length == 0) return;
            // Remove the last "&" if there is one
            if (sb[sb.Length - 1] == '&')
                sb.Remove(sb.Length - 1, 1);
        } 
    }
}